import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from '@/views/login/Login.vue';
import Play from '@/views/play/Play.vue';
import Query from '@/views/query/Query.vue';
import DrugsQuery from '@/views/query/DrugsQuery.vue';
import PlayImte from '@/views/play/PlayImte.vue';
import Project from '@/views/project/Project.vue';
import NoPage from '@/views/404.vue';
Vue.use(VueRouter);
const router = new VueRouter({
  mode: 'hash',
  routes: [
    {
      path: '/',
      name: 'home',
      meta: { title: '首页' },
      component: Project
    },
    {
      path: '/playImte',
      name: 'playImte',
      meta: { title: '支付' },
      component: PlayImte,
    },
    {
      path: '/play',
      name: 'play',
      meta: { title: '支付' },
      component: Play,
    },
    {
      path: '/query',
      name: 'query',
      meta: { title: '支付' },
      component: Query,
    },
    {
      path: '/drugsQuery',
      name: 'drugsQuery',
      meta: { title: '药品价格查询' },
      component: DrugsQuery,
    },
    {
      path: '/login',
      name: 'login',
      meta: { title: '登录' },
      component: Login,
    },
    {
      path: '*',
      redirect: '/404',
      component: NoPage,
    }
  ],
});

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
    if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
    return originalPush.call(this, location).catch(err => err)
}




export default router;
